#include <REGX52.H>
#include "Delay.h"
#include "MatrixLED.h"
#include "Timer0.h"

unsigned char data HELLO[] = {
	0x00,0x7F,0x08,0x08,0x7F,0x00,0x0E,0x15,
	0x15,0x15,0x08,0x00,0x7E,0x01,0x01,0x00,
	0x7E,0x01,0x01,0x00,0x0E,0x11,0x11,0x11,
	0x0E,0x00,0x7D,0x00,0x7D,0x00,0x7D,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x7F,0x08,0x08,0x7F,0x00,0x0E,0x15
};

unsigned char i = 0;

void main() {
	unsigned char j;
	
	MatrixLED_Init();
	Timer0_Init();
	
	while (1) {
		
		
		for (j = 0; j < 8; j++) {
			MatrixLED_ShowColumn(j + 1, HELLO[i + j]);
		}
	}

}

void Timer0_Isr(void) interrupt 1
{
	static unsigned int timer0Counter = 0;
	timer0Counter++;
	Timer0_Reload();
	
	if (timer0Counter >= 100) {
		timer0Counter = 0;
		if (++i > sizeof(HELLO) / sizeof(HELLO[0]) - 8)
			i = 1;
	}
}